<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %> 

 
<!DOCTYPE html>
<html>
<head>
    <title>招标阶段设置</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>招标阶段管理</h1>
        		    
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active">药品招标管理</li>
            <li class="active">采购项目管理</li>
            <li class="active">招标阶段管理</li>
        </ol>
    </section>
    <section class="content">
    	<div class=" box box-success">
            <form role="form" id="form" action="${ctx}/bidProject/setProjTime.html" method="post" class="form-horizontal" >
            	<input type="hidden" id="projId" name="projId" value="${info['projId']}">
            	<input type="hidden" name=passwordCount value="${info['passwordCount']}" />
            	<input type="hidden" name=firstSetPswd value="${info['firstSetPswd']}" />
                <div class="box-body">
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>招标开始日期：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="projStarttime" name="projStarttime" type="text" placeholder="招标开始日期" value="${info.projStarttime}"
                           	data-date-fmt="yyyy-MM-dd"  onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'projEndtime\')}'})"  />	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>招标结束日期：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="projEndtime" name="projEndtime" type="text" placeholder="招标结束日期" value="${info.projEndtime}"
                           	data-date-fmt="yyyy-MM-dd"  onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'projStarttime\')}'})" />
                        </div>
                        <div class="col-sm-2">
                        	
                        </div>
                    </div>
                    
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>资审开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="proAuditStarttime" name="proAuditStarttime" type="text" placeholder="资审开始时间" value="${info.proAuditStarttime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'proAuditEndtime\')}'})" />	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>资审结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="proAuditEndtime" name="proAuditEndtime" type="text" placeholder="资审结束时间"  value="${info.proAuditEndtime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'proAuditStarttime\')}'})" />
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "1"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('1')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "1"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('1')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>资审核结果公示开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="proAuditPubStarttime" name="proAuditPubStarttime" type="text" placeholder="资审核结果公示开始时间" value="${info.proAuditPubStarttime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'proAuditPubEndtime\')}'})" />	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>资审核结果公示结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="proAuditPubEndtime" name="proAuditPubEndtime" type="text" placeholder="资审核结果公示结束时间" value="${info.proAuditPubEndtime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'proAuditPubStarttime\')}'})" />
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "2"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('2')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "2"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('2')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>模拟报价开启时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceQuoteSimuStarttime" name="priceQuoteSimuStarttime" type="text" placeholder="模拟报价开启时间" value="${info.priceQuoteSimuStarttime}"
                           	data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'priceQuoteSimuEndtime\')}'})" />	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>模拟报价结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceQuoteSimuEndtime" name="priceQuoteSimuEndtime" type="text" placeholder="模拟报价结束时间"  value="${info.priceQuoteSimuEndtime}"
                           	data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'priceQuoteSimuStarttime\')}'})" />
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "3"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('3')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "3"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('3')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>报价开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceQuoteStarttime" name="priceQuoteStarttime" type="text" placeholder="报价开始时间"  value="${info.priceQuoteStarttime}"
                           	data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'priceQuoteEndtime\')}'})" />	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>报价结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceQuoteEndtime" name="priceQuoteEndtime" type="text" placeholder="报价结束时间" value="${info.priceQuoteEndtime}"
                           	data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'priceQuoteStarttime\')}'})" />
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "4"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('4')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "4"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('4')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                   
                   <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>报价解密开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceQuoteDecodeStarttime" name="priceQuoteDecodeStarttime" type="text" placeholder="报价解密开始时间" value="${info.priceQuoteDecodeStarttime}"
                           	data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'priceQuoteDecodeEndtime\')}'})"/>	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>报价解密结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceQuoteDecodeEndtime" name="priceQuoteDecodeEndtime" type="text" placeholder="报价解密结束时间" value="${info.priceQuoteDecodeEndtime}"
                           	 data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'priceQuoteDecodeStarttime\')}'})"/>
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "5"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('5')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "5"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('5')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>打分开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceGradeStarttime" name="priceGradeStarttime" type="text" placeholder="打分开始时间" value="${info.priceGradeStarttime}"
                           	 data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'priceGradeEndtime\')}'})" />	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>打分结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="priceGradeEndtime" name="priceGradeEndtime" type="text" placeholder="打分结束时间" value="${info.priceGradeEndtime}"
                           	 data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'priceGradeStarttime\')}'})"/>
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "6"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('6')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "6"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('6')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>拟中标结果公示开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="semiWinPubStarttime" name="semiWinPubStarttime" type="text" placeholder="拟中标结果公示开始时间" value="${info.semiWinPubStarttime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'semiWinPubEndtime\')}'})"/>	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>拟中标结果公示结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="semiWinPubEndtime" name="semiWinPubEndtime" type="text" placeholder="拟中标结果公示结束时间" value="${info.semiWinPubEndtime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'semiWinPubStarttime\')}'})"/>
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "7"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('7')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "7"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('7')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>申投诉开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="appealStarttime" name="appealStarttime" type="text" placeholder="申投诉开始时间"  value="${info.appealStarttime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'appealEndtime\')}'})"/>	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>申投诉结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="appealEndtime" name="appealEndtime" type="text" placeholder="申投诉结束时间"  value="${info.appealEndtime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'appealStarttime\')}'})"/>
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "8"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('8')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "8"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('8')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                    
                    <div class="form-group form-group-xs">
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>中标结果公示开始时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="winPubStarttime" name="winPubStarttime" type="text" placeholder="中标结果公示开始时间"  value="${info.winPubStarttime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({maxDate:'#F{$dp.$D(\'winPubEndtime\')}'})"/>	
                        </div>
                    	<label for="inputTextAlter4" class="col-sm-2 control-label"><span class="required">*</span>中标结果公示结束时间：</label>
                        <div class="col-sm-3">
                           	<input class="form-control" id="winPubEndtime" name="winPubEndtime" type="text" placeholder="中标结果公示结束时间" value="${info.winPubEndtime}"
                           	data-date-fmt="yyyy-MM-dd" onFocus=" WdatePicker({minDate:'#F{$dp.$D(\'winPubStarttime\')}'})"/>
                        </div>
                        <div class="col-sm-2">
                        <c:if test='${info["closeFlag"] == "9"}'>
                        		<label class="btn btn-default btn-sm" onclick="closePoint('9')">关 闭</label>
                        	</c:if>
                        	<c:if test='${info["openFlag"] == "9"}'>
                        		<label class="btn btn-default btn-sm" onclick="openPoint('9')">开 启</label>
                        	</c:if>
                        </div>
                    </div>
                   
                    
                </div>
                <div class="box-footer text-center">
                	<button type="button" class="btn btn-success btn-sm" onclick="validate();">保 存</button>
                    <a href="${ctx}/bidProject/toCheckPasswordList.html" class="btn btn-danger btn-sm back">返 回</a>
                </div>
            </form>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
    $(function(){
    	var defalutProjId = "${defalutProjId}";
		if(defalutProjId!=null && defalutProjId!=""){
			$("a.btn-danger").remove();
		}
    })
      //保存、校验
        function validate() {
        	
    		var projStarttime = $.trim($("#projStarttime").val());
    		if (projStarttime == null || projStarttime == "") {
    			$.HN.message.alert("请选择招标开始日期！", "消息", "warn");
    			return false;
    		}
    		var projEndtime = $.trim($("#projEndtime").val());
    		if (projEndtime == null || projEndtime == "") {
    			$.HN.message.alert("请选择招标结束日期！", "消息", "warn");
    			return false;
    		}
    		
			var proAuditStarttime = $.trim($("#proAuditStarttime").val());
    		if (proAuditStarttime == null || proAuditStarttime == "") {
    			$.HN.message.alert("请选择资申开始时间！", "消息", "warn");
    			return false;
    		}
    		
    		var proAuditEndtime = $.trim($("#proAuditEndtime").val());
    		if (proAuditEndtime == null || proAuditEndtime == "") {
    			$.HN.message.alert("请选择资申结束时间！", "消息", "warn");
    			return false;
    		}
			
    		
			var proAuditPubStarttime = $.trim($("#proAuditPubStarttime").val());
    		if (proAuditPubStarttime == null || proAuditPubStarttime == "") {
    			$.HN.message.alert("请选择资质审核结果公示开始时间！", "消息", "warn");
    			return false;
    		}
    		var proAuditPubEndtime = $.trim($("#proAuditPubEndtime").val());
    		if (proAuditPubEndtime == null || proAuditPubEndtime == "") {
    			$.HN.message.alert("请选择资质审核结果公示结束时间！", "消息", "warn");
    			return false;
    		}
			
			
			var priceQuoteSimuStarttime = $.trim($("#priceQuoteSimuStarttime").val());
    		if (priceQuoteSimuStarttime == null || priceQuoteSimuStarttime == "") {
    			$.HN.message.alert("请选择模拟报价开始时间！", "消息", "warn");
    			return false;
    		}
    		var priceQuoteSimuEndtime = $.trim($("#priceQuoteSimuEndtime").val());
    		if (priceQuoteSimuEndtime == null || priceQuoteSimuEndtime == "") {
    			$.HN.message.alert("请选择模拟报价结束时间！", "消息", "warn");
    			return false;
    		}
    		if(priceQuoteSimuStarttime > priceQuoteSimuEndtime) {
        		$.HN.message.alert("模拟报价结束时间应该大于等于开始时间！", "消息", "error");
        		return false;
        	}
			
			var priceQuoteStarttime = $.trim($("#priceQuoteStarttime").val());
    		if (priceQuoteStarttime == null || priceQuoteStarttime == "") {
    			$.HN.message.alert("请选择报价开始时间！", "消息", "warn");
    			return false;
    		}
    		var priceQuoteEndtime = $.trim($("#priceQuoteEndtime").val());
    		if (priceQuoteEndtime == null || priceQuoteEndtime == "") {
    			$.HN.message.alert("请选择报价结束时间！", "消息", "warn");
    			return false;
    		}
    		if(priceQuoteStarttime > priceQuoteEndtime) {
        		$.HN.message.alert("报价结束时间应该大于等于开始时间！", "消息", "error");
        		return false;
        	}
			
			var priceQuoteDecodeStarttime = $.trim($("#priceQuoteDecodeStarttime").val());
    		if (priceQuoteDecodeStarttime == null || priceQuoteDecodeStarttime == "") {
    			$.HN.message.alert("请选择报价解密开始时间！", "消息", "warn");
    			return false;
    		}
    		var priceQuoteDecodeEndtime = $.trim($("#priceQuoteDecodeEndtime").val());
    		if (priceQuoteDecodeEndtime == null || priceQuoteDecodeEndtime == "") {
    			$.HN.message.alert("请选择报价解密结束时间！", "消息", "warn");
    			return false;
    		}
    		if(priceQuoteDecodeStarttime > priceQuoteDecodeEndtime) {
        		$.HN.message.alert("报价解密结束时间应该大于等于开始时间！", "消息", "error");
        		return false;
        	}
			
			var priceGradeStarttime = $.trim($("#priceGradeStarttime").val());
    		if (priceGradeStarttime == null || priceGradeStarttime == "") {
    			$.HN.message.alert("请选择打分开始时间！", "消息", "warn");
    			return false;
    		}
    		var priceGradeEndtime = $.trim($("#priceGradeEndtime").val());
    		if (priceGradeEndtime == null || priceGradeEndtime == "") {
    			$.HN.message.alert("请选择打分结束时间！", "消息", "warn");
    			return false;
    		}
			
			var semiWinPubStarttime = $.trim($("#semiWinPubStarttime").val());
    		if (semiWinPubStarttime == null || semiWinPubStarttime == "") {
    			$.HN.message.alert("请选择拟中标结果公示开始时间！", "消息", "warn");
    			return false;
    		}
    		var semiWinPubEndtime = $.trim($("#semiWinPubEndtime").val());
    		if (semiWinPubEndtime == null || semiWinPubEndtime == "") {
    			$.HN.message.alert("请选择拟中标结果公示结束时间！", "消息", "warn");
    			return false;
    		}
			
			var appealStarttime = $.trim($("#appealStarttime").val());
    		if (appealStarttime == null || appealStarttime == "") {
    			$.HN.message.alert("请选择申投诉开始时间！", "消息", "warn");
    			return false;
    		}
    		var appealEndtime = $.trim($("#appealEndtime").val());
    		if (appealEndtime == null || appealEndtime == "") {
    			$.HN.message.alert("请选择申投诉结束时间！", "消息", "warn");
    			return false;
    		}
			
        	var winPubStarttime = $.trim($("#winPubStarttime").val());
    		if (winPubStarttime == null || winPubStarttime == "") {
    			$.HN.message.alert("请选择中标结果公示开始时间！", "消息", "warn");
    			return false;
    		}
    		var winPubEndtime = $.trim($("#winPubEndtime").val());
    		if (winPubEndtime == null || winPubEndtime == "") {
    			$.HN.message.alert("请选择中标结果公示结束时间！", "消息", "warn");
    			return false;
    		}
            $('#form').submit();
        }
        $('#form').ajaxForm({
            dataType : "json",
            timeout: 10000,
            success : function(result) {
                if (result.success) {
                    $.HN.message.alert("保存成功！", "消息", "success", function() {
                        document.location.href = "${ctx}/bidProject/toCheckPasswordList.html";
                    });
                } else {
                    $.HN.message.alert(result.msg || "保存失败！", "消息", "error");
                   
                }
            }
        });
       //开启节点
       function openPoint(point) {
    		
    		$.HN.message.confirm("确定开启吗？", '', '').on(function (e) {
          		 if(e){
    		$.post("${ctx }/bidProject/openPoint.html", {
    			"point":point,"projId":"${info['projId']}"
    		}, function(result) {
    			if (result.success) {
					$.HN.message.alert("操作成功！", "消息", "success");
					document.location.href='${ctx}/bidProject/toSetProjTime.html?projId=${info.projId}&pass="1"';
    			} else {
    				$.HN.message.alert("操作失败！", "消息", "error");
    			}
    		}, "json")
    	 }
		 
	 });
    	}
     //关闭节点
       function closePoint(point) {
    		$.HN.message.confirm("确定关闭吗？", '', '').on(function (e) {
          		 if(e){
    		$.post("${ctx }/bidProject/closePoint.html", {
    			"point":point,"projId":"${info['projId']}"
    		}, function(result) {
    			if (result) {
    				
					$.HN.message.alert("操作成功！", "消息", "success");
					document.location.href='${ctx}/bidProject/toSetProjTime.html?projId=${info.projId}&pass="1"';
    			} else {
    				$.HN.message.alert("操作失败！", "消息", "error");
    			}
    		}, "json")
    	 }
		 
	 });
    	}
    </script>
</body>
</html>